<template>
    <div class="myHead">
        <div class="dataChoice">
            <div class="block">
                <el-date-picker
                        v-model="value1"
                        type="date"
                        placeholder="选择日期">
                </el-date-picker>
            </div>
        </div>

        <div class="navList">
            <el-menu index="i+1" v-for="(item,i) in items" >
                <el-submenu>
                    <template slot="title"><span class="nav-title">{{item.name}}</span></template>
                    <el-menu-item-group  >
                        <el-menu-item v-for="(second,j) in item.investors" index="'i+1'-'j+1'"  @click="abcd" :data-id="second.id" :value="second.value" >{{second.name}}</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>
            </el-menu>
        </div>
        <div class="footer-op">
            <div class="btn add" @click="addProject">新增</div>
            <div class="btn add">修改</div>
            <div class="btn add">删除</div>
        </div>
        <addProject v-if="seen" id="show" :list="list"></addProject>
    </div>
</template>
<script>
    import axios from 'axios'
    import "../../style/css/container.css"
    import addProject from "./addProject.vue"
    import eventVue from '../../script/event.js'

    //global operatorInvestorAdmin
    export default{
        props:["items"],

        components:{
            addProject,
        },
        data(){
            return {
                list:{},
                isSubShow:false,
                msg:'收到货加班',
                seen: false,
                show:false,
                value1: '',
                itemList:{},

                pickerOptions0: {
                    disabledDate(time) {
                        return time.getTime() > Date.now();
                    }
                },
            }
        },
        mounted(){
        },
        created(){


             axios.get('/api/rest/area/province')
                 .then(response => {
                 const result = response.data
                 if (result.code===0) {
                 this.list = result.items

                 }
                 })
                 .catch(error => {
                 console.log(error)
             })

         /*   this.$http.get('/api/rest/area/province').then(function (res) {
                const rest = res.data;
                if (rest.code===0) {
                    alert("11111")
                    //console.log(result.items)
                    this.data.list = res.data.items
                    console.log(this.data.list )
                }
            });*/
        },
        methods: {
            showToggle:function(item){
                alert(item);
                console.log(item);
                item.isSubShow = !item.isSubShow
            },
            abcd(second){

                alert("111")
                this.itemList=event.currentTarget.getAttribute("data-id")
                console.log(window.operatorInvestorAdmin);
               //console.log(event.currentTarget.getAttribute("parent-id"))

                //console.log(event.target.getAttribute('parent-id'))
               
              eventVue.$emit("myfun",this.itemList)
            },
            handleOpen(key, keyPath) {
                console.log(key, keyPath);
            },
            handleClose(key, keyPath) {
                console.log(key, keyPath);
            },
            addProject: function () {

                if(this.seen==true){
                    this.show=false;
                    this.seen=false;
                }else{
                    this.show=true;
                    this.seen=true;
                }

            }
        }
    }
</script>
<style>
    .el-submenu__title{
        border-bottom: 1px solid #aaaaaa;
        background: none;
    }
    .el-submenu__title{

    }
    .el-submenu .el-menu-item{
        border-bottom: 1px solid #aaaaaa;
    }
</style>